def dnsSeachResult(Server,dnsName,domain):
    Temp = os.popen('nslookup ' + str(domain) + ' ' + str(Server)).read()
    print(os.popen('nslookup ' + str(domain) + ' ' + str(Server)).read())
    f=open('res.log','a')
    f.write('         DNS 服务器:'+dnsName+'         \n         DNS_IP地址：'+Server+'\n'+Temp+'\n')
    f.close()
def getDomain():
    if not os.path.exists('domain.txt'):
        return print("domain.txt文件不存在")
    domain=[]
    f=open('domain.txt','r')
    line=f.readline()
    for line in f:
        print(line)
        domain.append(line)
    return domain
if __name__=='__main__':
    import os
    #domain=[]
    if os.path.exists('res.log'):
        os.remove('res.log')
    dnsServer={ 'Google Dns':'8.8.8.8',
                '114 Dns':'114.114.114.114',
                '阿里云 Dns':'223.5.5.5',
                'DnsPod Dns':'119.29.29.29',
                '美国DNS':'208.67.222.222',
                '安徽DNS':'211.138.180.2',
                'Apple Dns':'115.29.189.118',
                #'重庆电信 DNS':'61.128.192.68',
                #'福建电信 DNS':'218.85.152.99',
                #'甘肃电信 DNS':'202.100.64.68',
                #'广东电信 DNS':'202.96.128.86',
                #'河南 DNS':'222.88.88.88',
                #'江苏电信 DNS':'218.2.2.2',
                #'山东电信 DNS':'219.146.1.66',
                #'上海  DNS':'202.96.209.133',
                #'浙江电信 DNS':'202.101.172.35'
               }
    while True:
        print("请输入你的域名：")
        domain=input(">")
        print("正在执行查询。。。。。。。。。。。。")
        for key in dnsServer:
            #print(key + '\n' + dnsServer[key])
            print('。。。。。。。。。。。。。。。。。。')
            dnsSeachResult(str(dnsServer[key]), str(key), domain)
        import pyperclip
        print("查询完毕，内容已经复制剪贴板")
        f1=open('res.log','r')
        tem2=f1.read()
        pyperclip.copy(tem2)
